<?php
function smarty_function_keywords($params, $smarty)
{
	if(!isset($params['text']))
	{
		return "[nouns error: argument \"text\" is not set!]";
	}
	
	$nouns_arr = array();
	
	$words = explode(" ", str_replace(array(",",".","-",":","?","!",";","\n","\r","\t",")","(",";","&"), " ", trim(strip_tags($params['text']))));
	
	foreach($words as $noun)
	{
		if(preg_match("/[A-Z]/", substr($noun, 0, 1)))
		{
			if(!in_array($noun, $nouns_arr))
			{
				$nouns_arr[] = $noun;
			}
		}
	}	
	
	return implode(",", array_slice($nouns_arr, 0, 25));
}